package com.wangyg.breadstore.utils;

import com.wangyg.breadstore.configuration.ApplicationContextHolder;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;

/**
 * Created by wangyg6 on 2019/5/16.
 */

public class RestTemplateUtil {

	static RestTemplate restTemplate = ApplicationContextHolder.getBean("restTemplate");

	public static <T> ResponseEntity<T> doProcess(String url, HttpMethod method, HttpEntity<?> requestEntity,
			Class<T> responseType, Object... uriVariables) throws RestClientException {
		return restTemplate.exchange(url, method, requestEntity, responseType, uriVariables);
	}


}
